
/***********************************************************************
 * Util class
 * 
 * Collection of utility functions
 *
 * Signature:
 *  public static int random(int bound);
 *  public static int randomNumber(int bound);
 *  public static String noSpaces (String text);
 *  public static Coord randomShift (int n);
 ***********************************************************************/

import java.util.*;

public class Util {

    private static Random rnd = new Random();

    public static int random(int bound) {
	return rnd.nextInt(bound);
    }

    public static int randomNumber(int bound) {
	return rnd.nextInt(bound)+1;
    }

    public static String noSpaces (String text) {
	return text.split("\\s++")[0].toLowerCase();
    }

    public static Coord randomShift (int n) {
	int dx = randomNumber(2*n+1)-n;
	int dy = randomNumber(2*n+1)-n;
	return Coord.create(dx,dy);
    }

}
